<?php

namespace app\api\validate;

use think\Validate;

class Url extends Validate {
    
    /**
     * 规则定义
     * @var array
     */
    protected $rule = [
        'link'       => ['require', 'length' => '12,250', 'regex' => '/(http|https):\/\/([\w.]+\/?)\S*/'],
        'expireTime' => 'length:11',
        'password'   => 'length:6,32',
        'remark'     => 'length:1,200',
    ];
    
    /**
     * 提示信息定义
     * @var array
     */
    protected $message = [
        'link'       => '请输入12-250字符http或https协议链接地址',
        'expireTime' => '请输入11位UNIX时间戳',
        'password'   => '请输入6-32位访问密码',
        'remark'     => '请输入1-200位备注',
    ];
    
    /**
     * 场景定义
     * @var array
     */
    public $scene = [
        'build' => ['link', 'expireTime', 'password', 'remark'],
    ];
}